//
//  CZTestViewController.swift
//  WeiBo
//
//  Created by Apple on 16/9/4.
//  Copyright © 2016年 KY. All rights reserved.
//

import UIKit

class CZTestViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.white
        setupNavUI()
    }
    
    fileprivate func setupNavUI() {
    
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "push", target: self, action: #selector(pushAction))
    }
    
    var label: UILabel?
    
    @objc fileprivate func pushAction() {
        let vc = CZTestViewController()
        navigationController?.pushViewController(vc, animated: true)
        
        
        
//        closure = {
//            //  属性默认是逃逸的也就是@escaping，需要加上self
//            self.label?.text = "哈哈"
//        }
    }

    var closure: (()->())?
    
    var closure1: ((Int)->())?
    func sum(a: Int, b: Int, callBack: @escaping (Int)->()) -> Void {
        //  默认闭包是不逃离这个函数的，想要逃离这个函数的作用域需要加上@escaping这个关键字
        callBack(a + b)
        closure1 = callBack
        
//        DispatchQueue.global().async {
//            DispatchQueue.main.async {
//                callBack(a + b)
//            }
//        }
    }
    
    
}
